import request from "./http";

export const reqBookList = (data={}) => {
  return request({
    url: '/books/list',
    method: 'get',
    params: data
  })
};

// 图书详情
export const reqBookDetail = (id, data={}) => {
  return request({
    url: '/books/detail/'+id,
    method: 'get',
    params: data
  })
}

// 图书类别
export const reqBookCategory = () => {
  return request({
    url: '/books/categories',
    method: 'get'
  })
}

// 删除一条图书类别
export const reqDeleteBookCategory = (id) => {
  return request({
    url: 'books/categories/' + id,
    method: 'delete',
  })
}

// 增加图书类别
export const reqAddBookCategory = (data={}) => {
  return request({
    url: 'books/categories',
    method: 'post',
    data
  })
}
// 更新一条图书类别
export const reqUpdateBookCategory = (id, data) => {
  return request({
    url: 'books/categories/'+ id,
    method: 'put',
    data,
  })
}
// 图书资讯
export const reqBookInfos = (data = {}) => {
  return request({
    url: 'books/infos',
    method: 'get',
    params: data
  })
}
// 图书单条资讯
export const reqBookInfosDetail = (id, data={}) => {
  return request({
    url: 'books/infos/'+ id,
    method: 'get',
    params: data
  })
}
// 更新图书资讯
export const reqUpdateBookInfo = (id, data={}) => {
  return request({
    url: 'books/infos/'+id,
    method: 'put',
    data,
  })
}
// 删除多条资讯
export const reqDeleteBookInfo = (data={}) => {
  return request({
    url: 'books/infos',
    method: 'delete',
    data
  })
}

// 图书通知
export const reqBookMessage = (data) => {
  return request({
    url: 'books/messages',
    method:'get',
    params: data,
  })
}

// 图书关键词
export const reqBookHotWord = (data) => {
  return request({
    url: 'books/hot_words',
    method: 'get',
    params: data,
  })
}
// 更新图书关键词
export const reqUpdateBookHotWord = (id, data) => {
  return request({
    url: 'books/hot_word/' + id,
    method: 'put',
    data
  })
}
// 创建图书关键词
export const reqCreateBookHotWord = (data) => {
  return request({
    url: 'books/hot_words',
    method: 'post',
    data
  })
}
// 删除图书关键词
export const reqDeleteBookHotWord = (data) => {
  return request({
    url: 'books/hot_words',
    method: 'delete',
    data
  })
}
// 最新图书
export const reqLatestBook = (data) => {
  return request({
    url: 'books/latest',
    method: 'get',
    params: data,
  })
}
